Skip to content

feat(webapp): admin Back Office tab with org API rate limit editor#3434

Merged
isshaddad merged 9 commits intomainfrom
feat/admin-back-office-rate-limit
Apr 23, 2026
Merged

feat(webapp): admin Back Office tab with org API rate limit editor#3434
isshaddad merged 9 commits intomainfrom
feat/admin-back-office-rate-limit

Conversation

@isshaddad
Copy link
Copy Markdown
Collaborator

Summary

  • New Back office tab at /admin, per-org detail page at /admin/back-office/orgs/:orgId designed to host future per-org admin actions (project count, delete account, YC deals).
  • First action: edit an organization's API rate limit — tokenBucket override (refill rate, interval, max tokens), with a live plain-English preview (e.g. "1,500 requests per minute · 750 request burst allowance"). Writes are audit-logged via the server logger.
  • Cleanup: removed unused v2? / v3? columns from the admin orgs list (display only — Prisma select untouched).

Test plan

  • Back office tab visible in admin nav and highlighted when on a sub-route
  • /admin/orgs shows a Back office "Open" link per row; no v2/v3 columns
  • Empty state at /admin/back-office links back to /admin/orgs
  • Detail page renders the effective rate limit in view mode; Edit reveals the form
  • Save writes Organization.apiRateLimiterConfig, returns to view mode, shows "Rate limit saved." banner
  • Invalid values surface inline field errors and keep edit mode
  • Non-admins hitting any new route are redirected to /
  • Server logs show admin.backOffice.rateLimit info line per mutation

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 23, 2026

⚠️ No Changeset found

Latest commit: 0e28498

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: da7f00b9-320a-49ca-b452-dbbab6e024af

📥 Commits

Reviewing files that changed from the base of the PR and between 697acd6 and 331d425.

📒 Files selected for processing (1)
  • apps/webapp/app/routes/admin.back-office.orgs.$orgId.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/webapp/app/routes/admin.back-office.orgs.$orgId.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (28)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
  • GitHub Check: sdk-compat / Bun Runtime
  • GitHub Check: sdk-compat / Cloudflare Workers
  • GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
  • GitHub Check: sdk-compat / Deno Runtime
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)

Walkthrough

Adds an admin back‑office section with server loaders enforcing admin-only access, a back‑office layout, a landing index route, and an organization detail route for viewing and editing an organization’s API rate‑limiter config. Implements server-side fetching, zod-validated form action to persist token-bucket overrides, and UI for previewing sustained/burst rates plus per-field validation and saved-state handling. Also updates the admin organizations table to link into the back‑office and enhances the Tabs component to support a per‑tab end?: boolean prop (default true) forwarded to TabLink/Remix NavLink.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Summary of key changes

  • Tabs component

    • Added tabs[].end?: boolean to TabsProps.
    • TabLink now accepts end?: boolean (default true) and forwards it to Remix NavLink for all visual variants.
  • New admin back‑office routes

    • routes/admin.back-office.tsx: loader enforces admin access; default export renders layout with Outlet.
    • routes/admin.back-office._index.tsx: loader enforces admin access; default export renders landing UI linking to organizations.
    • routes/admin.back-office.orgs.$orgId.tsx: loader requires admin, loads organization and computes effective rate-limiter (parsing stored config with fallback); action validates and persists token-bucket overrides (zod validation, interval parsing, integer constraints), logs previous/next config, and redirects with a saved flag; UI shows effective status, editable token-bucket form when applicable, field errors, and saved confirmation behavior.
  • Existing route updates

    • routes/admin.orgs.tsx: removed v2/v3 columns, adjusted empty-state colSpan, added "Back office" column with Open LinkButton to /admin/back-office/orgs/${org.id}.
    • routes/admin.tsx: added "Back office" tab entry with end: false.
  • Docs

    • Added server-changes/admin-back-office-rate-limit.md documenting the back‑office rollout and rate-limit editing feature.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding an admin Back Office tab with organization API rate limit editor functionality.
Description check ✅ Passed The description covers all required template sections: clear summary of changes, detailed test plan with specific scenarios, and checklist items. However, some non-critical sections lack detail (Screenshots section is empty).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/admin-back-office-rate-limit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@isshaddad isshaddad marked this pull request as ready for review April 23, 2026 15:00
devin-ai-integration[bot]

This comment was marked as resolved.

@isshaddad isshaddad marked this pull request as draft April 23, 2026 16:19
@isshaddad isshaddad marked this pull request as ready for review April 23, 2026 16:37
@isshaddad isshaddad merged commit 41434b5 into main Apr 23, 2026
71 of 73 checks passed
@isshaddad isshaddad deleted the feat/admin-back-office-rate-limit branch April 23, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants